<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/12/7
 * Time: 10:40
 */

namespace app\modules\api\models;

use yii;
use yii\db\Query;

class Suppliers
{
    private $table;

    public function __construct()
    {
        $this->table = yii::$app->db->tablePrefix.'suppliers';
    }

    public function list()
    {
        $db = new Query();
        return $db->select('*')->from($this->table)->all();
    }

    public function add($data)
    {
        $data['create_at'] = time();
        return yii::$app->db->createCommand()->insert($this->table,$data)->execute();
    }
}